package com.mac.Member;

import com.mac.pojo.Member;
import com.mac.pojo.User;
import com.mac.service.MemberService;
import com.mac.service.UserService;
import org.junit.Test;

import java.sql.Date;
import java.util.List;

public class test{
    MemberService memberService = new MemberService();

    UserService userService = new UserService();
    /**
     * 对根据名字查询成员信息进行测试
     */
    @Test
    public void selectByMemberName(){
        Member member =  memberService.selectByMemberName("潘杰");
        System.out.println(member);
    }

    /**
     *  给入Member类，进行信息修改
     */
    @Test
    public void changeMemberInfo(){
        Member member = new Member();
        member.setMemberName("潘杰");
        member.setPosition("后端工程师");
        memberService.changeMemberInfo(member);
    }

    @Test
    public void addMember(){
        User user = userService.ifUserExists("Sunflower");

        Member member = new Member();

        member.setUserId(user.getUserId());
        member.setMemberName("潘杰");
        member.setGender("男");
        member.setPosition("后端工程师");
        Date date = Date.valueOf("2005-05-19");
        member.setBirthdayDate(date);
        member.setHonors("江西师范大学三好学生");
        member.setBios("lalalala");
        member.setMotto("lalalala");

        boolean addMember = memberService.addMember(member);

        System.out.println(addMember);
    }

    @Test
    public void selectAllMember(){
        List<Member> members = memberService.selectAllMember();
        System.out.println(members);
    }
}
